using System.Collections.Generic;
using EnvDTE;
using EnvDTE80;

namespace TddGenerator.Core.Services.Impl
{
    public class ProjectRepository : IProjectRepository
    {
        private readonly DTE2 dte;

        public ProjectRepository(DTE2 dte)
        {
            this.dte = dte;
        }

        public IEnumerable<string> GetProjectNames()
        {
            List<string> projectlist = new List<string>();

            Solution solution = dte.Solution;
            if(solution!=null)
            {
                foreach(Project project in solution.Projects)
                {
                    projectlist.Add(project.Name);
                }
            }
            projectlist.Sort();
            return projectlist;
        }
    }
}